﻿using System;
using System.Resources;
using System.Threading;

namespace MMD_Morph_NoteHelp
{
    // ==================
    //      多语言翻译
    // ==================
    public static class L10n
    {
        private static readonly ResourceManager ResManager =
            new ResourceManager("MMD_Morph_NoteHelp.LanguageList.Resource", typeof(MainForm).Assembly);

        /// <summary>
        /// 获取翻译后的字符串
        /// </summary>
        public static string Get(string key)
        {
            return ResManager.GetString(key, Thread.CurrentThread.CurrentUICulture) ?? key;
        }

        /// <summary>
        /// 获取翻译后的、带格式的字符串
        /// </summary>
        public static string Get(string key, params object[] args)
        {
            string format = ResManager.GetString(key, Thread.CurrentThread.CurrentUICulture) ?? key;
            return string.Format(format, args);
        }
    }
}